
enum Context {
    Text(String),
    Float(f32),
    Int(i32),
}

enum SpreadsheetCell {
    Int(i32),
    Float(f64),
    Text(String),
}

fn main() {
    // let v: Vec<i32> = Vec::new();
    // let mut v: Vec<i32> = Vec::new();
    // v.push(1);

    let v = vec![1, 2, 3];
    
    {
        let v1 = vec![2, 3,4];
    }

    let one: &i32 = &v[1];
    println!("one = {}", one);
    println!("*one = {}", *one);
    // suggestion
    match v.get(2) {
        Some(value) => println!("value = {}", value),
        _ => println!("None"),
    }

    let mut v2: Vec<i32> = Vec::new();
    v2.push(3);
    v2.push(4);
    v2.push(5);

    for i in &v2 {
        println!("v[i] = {}", i);
    }

    println!("++++++++");
    for i in &mut v2 {
        *i += 2;
        println!("v[i] = {}", i);
    }

    let c1 = vec![
        Context::Text(String::from("hello")),
        Context::Int(-1),
        Context::Float(0.01)
    ];

    println!("++++++++");
    let mut v3 = vec![2, 3, 4, 5];
    let first = &v3[3];
    println!("first = {}", first);

    let row = vec![
        SpreadSheetCell::Int(3),
        SpreadSheetCell::Text(String::from("blue")),
        SpreadSheetCell::Float(10, 12),
    ];
    println!("Hello, world!");
}
